<?php include '../public/header.php' ?>
<?php include '../public/header_index.php' ?>
<body class="laytp-container">
<div id="opt_nav">
</div>

<div class="layui-card" id="search-form">
    <div class="layui-card-body">
        <form class="layui-form" id="TableSearchFormId" lay-filter="TableSearchForm" onkeydown="keyTableSearch('TableSearchForm', 'datalist')">
            <div class="layui-form-item">
                <div class="layui-row">
                    <div class="layui-col-md3">
                        <label class="layui-form-label">工程名称</label>
                        <div class="layui-input-block">
                            <input type="text" name="enginname" placeholder="请输入" class="layui-input" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-col-md3">
                        <label class="layui-form-label">资金渠道</label>
                        <div class="layui-input-block">
                            <input type="text" name="qu_enginname" placeholder="请输入" class="layui-input" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-col-md3">
                        <label class="layui-form-label">工程负责人</label>
                        <div class="layui-input-block">
                            <input type="text" name="gofuer" id="gofuer" placeholder="请输入" class="layui-input" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">款项类型</label>
                        <div class="layui-input-block">
                            <div id="zhikuanlei" class="xmselect_div">
                                <div class="xmselect_title">请选择</div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">付款对象</label>
                        <div class="layui-input-block">
                            <input type="text" name="fuer" placeholder="请输入" class="layui-input" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">业务归属</label>
                        <div class="layui-input-block">
                            <div id="gui_unit" class="xmselect_div">
                                <div class="xmselect_title">请选择</div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">审核状态：</label>
                        <div class="layui-input-block">
                            <select id="status" name="status" lay-filter="status">
                                <option value="">请选择</option>
                                <option value="1">流程（审批通过）</option>
                                <option value="0">流程（审批中）</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-col-md3">
                        <div class="layui-form-item search-div">
                            <div class="layui-form-item layui-inline">
                                <button class="laytp-btn laytp-btn-md laytp-btn-primary" id="TableSearchButton" type="button"><i class="layui-icon layui-icon-search"></i>查询</button>
                                <button class="layui-btn layui-btn-primary" onclick="listTableReset()" id="TableSearchReset" type="reset" ><i class="layui-icon layui-icon-refresh"></i>重置</button>
                                <div id="search_open" onclick="toggle_search()">
                                    <i class="layui-icon layui-icon-down"></i>展开
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>

<div class="layui-card" id="table-card">
    <div class="layui-card-body">
        <div class="layui-row">
            <div class="layui-col-md12" id="table_list">
                <div class="layui-card-body">
                    <table id="datalist" lay-filter="datalist"></table>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/html" id="test-dropdown-toolbar-barDemo">
    <div class="tab-list-authbut">
        <a href="javascript:;" class="bar_opt" onclick="auth_but_func_show('查看','{{d.LAY_TABLE_INDEX}}')">查看</a>
    </div>
</script>
<script type="text/html" id="toolbarDemo">
    <div class = "layui-btn-container">
    </div>
</script>
<script>
    var param_qu_enginid = getQueryVariable('qu_enginid') || 0;
    var param_enginid = getQueryVariable('enginid') || 0;
    var param_status = getQueryVariable('status') || '';
    $("#status").val(param_status)

    var param_gofuer = decodeURI(getQueryVariable('gofuer') || '') || '';
    if(param_gofuer){
        $("#gofuer").val(param_gofuer)
    }
    var param_qutype = getQueryVariable('qutype') || '';
    var param_dealtype = getQueryVariable('dealtype') || '';

    layui.use(["laytp",'laypage','table','dropdown','form','soulTable'], function () {
        var laypage = layui.laypage, table = layui.table, dropdown = layui.dropdown, form = layui.form, soulTable = layui.soulTable;


        $('#TableSearchReset').click(function () {
            $('.xmselect_div>xm-select').find('.xm-label-block').css('display','none');
            $('.xmselect_div').append('<div class="xmselect_title">请选择</div>');
            searchTableFunc(form, table)
        });


        setSouTableExport('工程付款明细');
        var mytable = table.render({
            elem: "#datalist",id: "datalist"
            ,url: facade.url(ask_hou_chi_gongzhi_list),where: {enginid:param_enginid,status:param_status,gofuer:param_gofuer
                ,qutype:param_qutype,qu_enginid:param_qu_enginid,dealtype:param_dealtype}, page: true, height: 'full-140'
            ,soulSort: TabInit.soulSort,method: TabInit.method, toolbar: TabInit.toolbar, overflow: TabInit.overflow
            ,defaultToolbar: TabInit.defaultToolbar,filter: TabInit.filter
            ,request: TabInit.request,response: TabInit.response,contextmenu:get_table_contextmenu(soulTable)
            ,text: TabInit.text,totalRow: true
            ,parseData: function (res) {
                xmselect_dan('zhikuanlei', res.data.zhikuanlei, res.data.is_zhikuanlei, function (res) {
                    setTimeout(function () {
                        searchTableFunc(form, table);
                    },100)
                })


                xmselect_dan('gui_unit', res.data.gui_unit, res.data.is_gui_unit, function (res) {
                    setTimeout(function () {
                        searchTableFunc(form, table);
                    },100)
                })

                render_from();
                return {
                    "code": res.code,
                    "msg": res.message,
                    "count": res.data.data.total,
                    "data": res.data.data.data
                };
            }
            , cols: [[
                {type:'numbers',title:'序号',totalRowText: '合计',fixed:'left'}
                ,{field: 'shulai', title: '数据来源'}
                ,{field: 'sericnum', title: '流程单号'}
                ,{field:'status',title:'审核状态',width:120,templet: function(d){
                    if(d.billid > 0){
                        if(d.status == 0){
                            return '<div style="text-align: center"><span class="list_billid billstrlan" onclick="openPage(\'../hou_gongzhi/show.php?id='+d.gongzhiid+'\');">审批中</span></div>'
                        }else if(d.status == 1){
                            return '<div style="text-align: center"><span class="list_billid billstrlv" onclick="openPage(\'../hou_gongzhi/show.php?id='+d.gongzhiid+'\');">审批通过</span></div>'
                        }else{
                            return '';
                        }
                    }
                    return '';
                }}
                ,{field: 'enginname', title: '费用所属工程名称'}
                ,{field: 'zhikuanlei_name', title: '款项类型'}
                ,{field: 'listexplain', title: '款项说明'}
                ,{field: 'fuer', title: '付款对象'}
                ,{field:'listmoney',title:'本次付款金额(元)',totalRow: true,templet: function(d){
                        return parseFormatNum(d.listmoney);
                    }}
                ,{field: 'type_name', title: '资金渠道'}
                ,{field:'money',title:'当前渠道支出金额(元)',totalRow: true,templet: function(d){
                        return parseFormatNum(d.money);
                    }}
                ,{field: 'gofuer', title: '工程负责人'}
                ,{field: 'gui_unit_name', title: '业务归属'}
            ]]
            , done: function (res) {
                soulTable.render(this);
            }
        });


        listTableSearch(form, table);
    });

</script>
</body>
</html>
